package com.ccl.iot.device;

import com.ccl.iot.IOTNetAPIEnum;
import com.ccl.iot.object.IOTDeviceInfoEx;

/**
 * 创建者     王浩
 * 创建时间   2017/5/19 15:32
 * 描述	     虚拟设备(将其他设备转换成ccl设备,主要针对博联的设备和监控设备)
 */

public class IOTVirtualDevice extends IOTDevice {
    public IOTVirtualDevice(long aDevID) {
        super(aDevID, new IOTDeviceInfoEx(IOTDeviceConst.TDEVICE_TYPE.EDEVICE_TYPE_TERMINAL_BLIR, IOTDeviceConst.TDEVICE_TYPE.EDEVICE_TYPE_TERMINAL_BLIR, 0, 0), 0, 0);
        this.setAuth(IOTNetAPIEnum.EAUTH_STATE.EAUTH_STATE_FULL);       //设置权限为完全控制权限
    }

    @Override
    public byte[] getRegister() {
        return new byte[0];
    }

    @Override
    public void updateRegister(int aAddress, int aSize, byte[] aData, int aDataPos, int aNetWork, long time) {

    }

    @Override
    public int getAuth() {
        return IOTNetAPIEnum.EAUTH_STATE.EAUTH_STATE_FULL;
    }

    @Override
    public boolean isReadable() {
        return true;
    }

    @Override
    public boolean isWritable() {
        return true;
    }

    @Override
    public String getStateID() {
        return null;
    }

    @Override
    public String[] getStateIDs() {
        return new String[0];
    }

    @Override
    public boolean setOnline(boolean aOnline) {
        return super.setOnline(true);
    }

    public void onRemove(){
        super.setOnline(false);
    }
}
